package com.xhwl.logistics.converter.mapstruct;

import com.xhwl.common.dto.cent.vehicle.feign.CreateBiVehicleCardAccessRecordHourFeignDTO;
import com.xhwl.common.dto.cent.vehicle.feign.CreateBiVehicleCardPayRecordHourFeignDTO;
import com.xhwl.common.dto.cent.vehicle.feign.CreateBiVehicleCarportRecordMinuteFeignDTO;
import com.xhwl.common.dto.cent.vehicle.feign.CreateBiVehicleLocationAccessRecordHourFeignDTO;
import com.xhwl.logistics.enums.VehicleCardTypeEnum;
import com.xhwl.logistics.po.VehicleCardAccessRecordStatisticsPO;
import com.xhwl.logistics.po.VehicleCardPayRecordStatisticsPO;
import com.xhwl.logistics.po.VehicleLocationAccessRecordStatisticsPO;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueMappingStrategy;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Mapper(componentModel = "spring", nullValueMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT)
public interface VehicleStatisticsConverter {

    //************Carport Statistics************
    //************KeTop************
    default CreateBiVehicleCarportRecordMinuteFeignDTO toCreateBiVehicleCarportRecordMinuteFeignDTO(Integer projectId, String parkingName,
                                                                                                    Integer totalNumber, Integer freeNumber, Integer existingNumber,
                                                                                                    Date processTime, Date ingestionTime) {
        CreateBiVehicleCarportRecordMinuteFeignDTO createBiVehicleCarportRecordMinuteFeignDTO = new CreateBiVehicleCarportRecordMinuteFeignDTO();
        createBiVehicleCarportRecordMinuteFeignDTO.setProjectId(projectId);
        createBiVehicleCarportRecordMinuteFeignDTO.setParkingName(parkingName);
        createBiVehicleCarportRecordMinuteFeignDTO.setTotalNumber(totalNumber);
        createBiVehicleCarportRecordMinuteFeignDTO.setFreeNumber(freeNumber);
        createBiVehicleCarportRecordMinuteFeignDTO.setExistingNumber(existingNumber);
        createBiVehicleCarportRecordMinuteFeignDTO.setProcessTime(processTime);
        createBiVehicleCarportRecordMinuteFeignDTO.setIngestionTime(ingestionTime);
        return createBiVehicleCarportRecordMinuteFeignDTO;
    }
    //************KeTop************
    //************Carport Statistics************


    //************Card Access Statistics************
    //************KeTop************
    //可以考虑使用反射来消除太多的if else
    default CreateBiVehicleCardAccessRecordHourFeignDTO toCreateBiVehicleCardAccessRecordHourFeignDTO(Integer projectId,
                                                                                                      String parkingLotName,
                                                                                                      Date processDate,
                                                                                                      Date ingestionDate,
                                                                                                      List<VehicleCardAccessRecordStatisticsPO> cardAccessRecordForIn,
                                                                                                      List<VehicleCardAccessRecordStatisticsPO> cardAccessRecordForOut) {
        CreateBiVehicleCardAccessRecordHourFeignDTO createBiVehicleCardAccessRecordHourFeignDTO = new CreateBiVehicleCardAccessRecordHourFeignDTO();
        createBiVehicleCardAccessRecordHourFeignDTO.setProjectId(projectId);
        createBiVehicleCardAccessRecordHourFeignDTO.setParkingName(parkingLotName);
        createBiVehicleCardAccessRecordHourFeignDTO.setProcessTime(processDate);
        createBiVehicleCardAccessRecordHourFeignDTO.setIngestionTime(ingestionDate);

        cardAccessRecordForIn.forEach(vehicleCardAccessRecordStatisticsPO -> {
            Integer cardType = vehicleCardAccessRecordStatisticsPO.getCardType();
            Integer count = vehicleCardAccessRecordStatisticsPO.getCount();
            switch (VehicleCardTypeEnum.toVehicleCardTypeEnum(cardType)) {
                case TEMPORARILY:
                case TEMPORARY_BOOKING:
                case OWNER_TEMPORARY:
                    createBiVehicleCardAccessRecordHourFeignDTO.setTemporaryCardIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTemporaryCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTemporaryCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case MONTH:
                    createBiVehicleCardAccessRecordHourFeignDTO.setMonthCardIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setMonthCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getMonthCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case STORE:
                    createBiVehicleCardAccessRecordHourFeignDTO.setStoredValueCardIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setStoredValueCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getStoredValueCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case FREE:
                    createBiVehicleCardAccessRecordHourFeignDTO.setFreeCardIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setFreeCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getFreeCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case VISITOR:
                    createBiVehicleCardAccessRecordHourFeignDTO.setVisitorCardIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setVisitorCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getVisitorCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                case VIP:
                    createBiVehicleCardAccessRecordHourFeignDTO.setVipCarIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setVipCarTotal(createBiVehicleCardAccessRecordHourFeignDTO.getVipCarTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case HOUR_RENT:
                    createBiVehicleCardAccessRecordHourFeignDTO.setHourRentCarIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setHourRentCarTotal(createBiVehicleCardAccessRecordHourFeignDTO.getHourRentCarTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case PROPERTY_RIGHT:
                    createBiVehicleCardAccessRecordHourFeignDTO.setPropertyRightCarIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setPropertyRightCarTotal(createBiVehicleCardAccessRecordHourFeignDTO.getPropertyRightCarTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case COUNTING:
                    createBiVehicleCardAccessRecordHourFeignDTO.setCountingCarIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setCountingCarTotal(createBiVehicleCardAccessRecordHourFeignDTO.getCountingCarTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case HONORED_GUEST:
                    createBiVehicleCardAccessRecordHourFeignDTO.setHonoredGuestCardIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setHonoredGuestCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getHonoredGuestCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case EMPLOYEE:
                    createBiVehicleCardAccessRecordHourFeignDTO.setEmployeeCardIn(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setEmployeeCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getEmployeeCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setIn(createBiVehicleCardAccessRecordHourFeignDTO.getIn() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                default:
                    break;
            }
        });

        cardAccessRecordForOut.forEach(vehicleCardAccessRecordStatisticsPO -> {
            Integer cardType = vehicleCardAccessRecordStatisticsPO.getCardType();
            Integer count = vehicleCardAccessRecordStatisticsPO.getCount();
            switch (VehicleCardTypeEnum.toVehicleCardTypeEnum(cardType)) {
                case TEMPORARILY:
                case TEMPORARY_BOOKING:
                case OWNER_TEMPORARY:
                    createBiVehicleCardAccessRecordHourFeignDTO.setTemporaryCardOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTemporaryCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTemporaryCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case MONTH:
                    createBiVehicleCardAccessRecordHourFeignDTO.setMonthCardOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setMonthCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getMonthCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case STORE:
                    createBiVehicleCardAccessRecordHourFeignDTO.setStoredValueCardOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setStoredValueCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getStoredValueCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case FREE:
                    createBiVehicleCardAccessRecordHourFeignDTO.setFreeCardOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setFreeCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getFreeCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case VISITOR:
                    createBiVehicleCardAccessRecordHourFeignDTO.setVisitorCardOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setVisitorCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getVisitorCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                case VIP:
                    createBiVehicleCardAccessRecordHourFeignDTO.setVipCarOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setVipCarTotal(createBiVehicleCardAccessRecordHourFeignDTO.getVipCarTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case HOUR_RENT:
                    createBiVehicleCardAccessRecordHourFeignDTO.setHourRentCarOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setHourRentCarTotal(createBiVehicleCardAccessRecordHourFeignDTO.getHourRentCarTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case PROPERTY_RIGHT:
                    createBiVehicleCardAccessRecordHourFeignDTO.setPropertyRightCarOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setPropertyRightCarTotal(createBiVehicleCardAccessRecordHourFeignDTO.getPropertyRightCarTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case COUNTING:
                    createBiVehicleCardAccessRecordHourFeignDTO.setCountingCarOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setCountingCarTotal(createBiVehicleCardAccessRecordHourFeignDTO.getCountingCarTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case HONORED_GUEST:
                    createBiVehicleCardAccessRecordHourFeignDTO.setHonoredGuestCardOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setHonoredGuestCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getHonoredGuestCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                    break;
                case EMPLOYEE:
                    createBiVehicleCardAccessRecordHourFeignDTO.setEmployeeCardOut(count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setEmployeeCardTotal(createBiVehicleCardAccessRecordHourFeignDTO.getEmployeeCardTotal() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setOut(createBiVehicleCardAccessRecordHourFeignDTO.getOut() + count);
                    createBiVehicleCardAccessRecordHourFeignDTO.setTotal(createBiVehicleCardAccessRecordHourFeignDTO.getTotal() + count);
                default:
                    break;
            }
        });

        return createBiVehicleCardAccessRecordHourFeignDTO;
    }
    //************KeTop************
    //************Card Access Statistics************


    //************Location Access Statistics************
    //************KeTop************
    //可以考虑使用反射来消除太多的if else
    default List<CreateBiVehicleLocationAccessRecordHourFeignDTO> toCreateBiVehicleLocationAccessRecordHourFeignDTOList(Integer projectId,
                                                                                                                        String parkingLotName,
                                                                                                                        Date processDate,
                                                                                                                        Date ingestionDate,
                                                                                                                        List<VehicleLocationAccessRecordStatisticsPO> locationForIn,
                                                                                                                        List<VehicleLocationAccessRecordStatisticsPO> locationForOut) {
        Map<String, List<VehicleLocationAccessRecordStatisticsPO>> locationForInMap = locationForIn.stream().collect(Collectors.groupingBy(VehicleLocationAccessRecordStatisticsPO::getPassageName));
        Map<String, List<VehicleLocationAccessRecordStatisticsPO>> locationForOutMap = locationForOut.stream().collect(Collectors.groupingBy(VehicleLocationAccessRecordStatisticsPO::getPassageName));

        List<CreateBiVehicleLocationAccessRecordHourFeignDTO> createBiVehicleLocationAccessRecordHourFeignDTOList = new ArrayList<>();
        locationForInMap.forEach((key, value) -> {
            CreateBiVehicleLocationAccessRecordHourFeignDTO createBiVehicleLocationAccessRecordHourFeignDTO = new CreateBiVehicleLocationAccessRecordHourFeignDTO();
            createBiVehicleLocationAccessRecordHourFeignDTO.setProjectId(projectId);
            createBiVehicleLocationAccessRecordHourFeignDTO.setParkingName(parkingLotName);
            createBiVehicleLocationAccessRecordHourFeignDTO.setPassageName(key);
            createBiVehicleLocationAccessRecordHourFeignDTO.setProcessTime(processDate);
            createBiVehicleLocationAccessRecordHourFeignDTO.setIngestionTime(ingestionDate);

            for (VehicleLocationAccessRecordStatisticsPO vehicleLocationAccessRecordStatisticsPO : value) {
                VehicleCardTypeEnum vehicleCardTypeEnum = VehicleCardTypeEnum.toVehicleCardTypeEnum(vehicleLocationAccessRecordStatisticsPO.getCardType());
                Integer count = vehicleLocationAccessRecordStatisticsPO.getCount();
                switch (vehicleCardTypeEnum) {
                    case TEMPORARILY:
                    case TEMPORARY_BOOKING:
                    case OWNER_TEMPORARY:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setTemporaryCardIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setTemporaryCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                        break;
                    case MONTH:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setMonthCardIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setMonthCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                        break;
                    case STORE:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setStoredValueCardIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setStoredValueCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                        break;
                    case FREE:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setFreeCardIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setFreeCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                        break;
                    case VISITOR:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setVisitorCardIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setVisitorCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                    case VIP:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setVipCarIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setVipCarTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                        break;
                    case HOUR_RENT:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setHourRentCarIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setHourRentCarTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                        break;
                    case PROPERTY_RIGHT:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setPropertyRightCarIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setPropertyRightCarTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                        break;
                    case COUNTING:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setCountingCarIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setCountingCarTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                        break;
                    case HONORED_GUEST:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setHonoredGuestCardIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setHonoredGuestCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                        break;
                    case EMPLOYEE:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setEmployeeCardIn(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setEmployeeCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setIn(createBiVehicleLocationAccessRecordHourFeignDTO.getIn() + count);
                    default:
                        break;
                }
            }
            createBiVehicleLocationAccessRecordHourFeignDTO.setTotal(createBiVehicleLocationAccessRecordHourFeignDTO.getIn());
            createBiVehicleLocationAccessRecordHourFeignDTOList.add(createBiVehicleLocationAccessRecordHourFeignDTO);
        });

        locationForOutMap.forEach((key, value) -> {
            CreateBiVehicleLocationAccessRecordHourFeignDTO createBiVehicleLocationAccessRecordHourFeignDTO = new CreateBiVehicleLocationAccessRecordHourFeignDTO();
            createBiVehicleLocationAccessRecordHourFeignDTO.setProjectId(projectId);
            createBiVehicleLocationAccessRecordHourFeignDTO.setParkingName(parkingLotName);
            createBiVehicleLocationAccessRecordHourFeignDTO.setPassageName(key);
            createBiVehicleLocationAccessRecordHourFeignDTO.setProcessTime(processDate);
            createBiVehicleLocationAccessRecordHourFeignDTO.setIngestionTime(ingestionDate);

            for (VehicleLocationAccessRecordStatisticsPO vehicleLocationAccessRecordStatisticsPO : value) {
                VehicleCardTypeEnum vehicleCardTypeEnum = VehicleCardTypeEnum.toVehicleCardTypeEnum(vehicleLocationAccessRecordStatisticsPO.getCardType());
                Integer count = vehicleLocationAccessRecordStatisticsPO.getCount();
                switch (vehicleCardTypeEnum) {
                    case TEMPORARILY:
                    case TEMPORARY_BOOKING:
                    case OWNER_TEMPORARY:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setTemporaryCardOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setTemporaryCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                        break;
                    case MONTH:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setMonthCardOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setMonthCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                        break;
                    case STORE:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setStoredValueCardOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setStoredValueCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                        break;
                    case FREE:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setFreeCardOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setFreeCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                        break;
                    case VISITOR:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setVisitorCardOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setVisitorCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                    case VIP:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setVipCarOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setVipCarTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                        break;
                    case HOUR_RENT:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setHourRentCarOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setHourRentCarTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                        break;
                    case PROPERTY_RIGHT:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setPropertyRightCarOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setPropertyRightCarTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                        break;
                    case COUNTING:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setCountingCarOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setCountingCarTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                        break;
                    case HONORED_GUEST:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setHonoredGuestCardOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setHonoredGuestCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                        break;
                    case EMPLOYEE:
                        createBiVehicleLocationAccessRecordHourFeignDTO.setEmployeeCardOut(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setEmployeeCardTotal(count);
                        createBiVehicleLocationAccessRecordHourFeignDTO.setOut(createBiVehicleLocationAccessRecordHourFeignDTO.getOut() + count);
                    default:
                        break;
                }
            }
            createBiVehicleLocationAccessRecordHourFeignDTO.setTotal(createBiVehicleLocationAccessRecordHourFeignDTO.getOut());
            createBiVehicleLocationAccessRecordHourFeignDTOList.add(createBiVehicleLocationAccessRecordHourFeignDTO);
        });

        return createBiVehicleLocationAccessRecordHourFeignDTOList;
    }
    //************KeTop************
    //************Location Access Statistics************


    //************Card Pay Statistics************
    //************KeTop************
    //可以考虑使用反射来消除太多的if else
    default CreateBiVehicleCardPayRecordHourFeignDTO toCreateBiVehicleCardPayRecordHourFeignDTO(Integer projectId,
                                                                                                String parkingLotName,
                                                                                                Date processDate,
                                                                                                Date ingestionDate,
                                                                                                List<VehicleCardPayRecordStatisticsPO> vehicleCardPayRecordStatisticsPOList) {
        CreateBiVehicleCardPayRecordHourFeignDTO createBiVehicleCardPayRecordHourFeignDTO = new CreateBiVehicleCardPayRecordHourFeignDTO();
        createBiVehicleCardPayRecordHourFeignDTO.setProjectId(projectId);
        createBiVehicleCardPayRecordHourFeignDTO.setParkingName(parkingLotName);
        createBiVehicleCardPayRecordHourFeignDTO.setProcessTime(processDate);
        createBiVehicleCardPayRecordHourFeignDTO.setIngestionTime(ingestionDate);

        vehicleCardPayRecordStatisticsPOList.forEach(vehicleCardPayRecordStatisticsPO -> {
            Integer cardType = vehicleCardPayRecordStatisticsPO.getCardType();
            Integer paidMoney = vehicleCardPayRecordStatisticsPO.getPaidMoney();

            switch (VehicleCardTypeEnum.toVehicleCardTypeEnum(cardType)) {
                case TEMPORARILY:
                case TEMPORARY_BOOKING:
                case OWNER_TEMPORARY:
                    createBiVehicleCardPayRecordHourFeignDTO.setTemporaryCardPay(createBiVehicleCardPayRecordHourFeignDTO.getTemporaryCardPay()+paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                    break;
                case MONTH:
                    createBiVehicleCardPayRecordHourFeignDTO.setMonthCardPay(paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                    break;
                case STORE:
                    createBiVehicleCardPayRecordHourFeignDTO.setStoredValueCardPay(paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                    break;
                case FREE:
                    createBiVehicleCardPayRecordHourFeignDTO.setFreeCardPay(paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                    break;
                case VISITOR:
                    createBiVehicleCardPayRecordHourFeignDTO.setVisitorCardPay(paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                case VIP:
                    createBiVehicleCardPayRecordHourFeignDTO.setVipCarPay(paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                    break;
                case HOUR_RENT:
                    createBiVehicleCardPayRecordHourFeignDTO.setHourRentCarPay(paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                    break;
                case PROPERTY_RIGHT:
                    createBiVehicleCardPayRecordHourFeignDTO.setPropertyRightCarPay(paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                    break;
                case COUNTING:
                    createBiVehicleCardPayRecordHourFeignDTO.setCountingCarPay(paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                    break;
                case HONORED_GUEST:
                    createBiVehicleCardPayRecordHourFeignDTO.setHonoredGuestCardPay(paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                    break;
                case EMPLOYEE:
                    createBiVehicleCardPayRecordHourFeignDTO.setEmployeeCardPay(paidMoney);
                    createBiVehicleCardPayRecordHourFeignDTO.setTotal(createBiVehicleCardPayRecordHourFeignDTO.getTotal() + paidMoney);
                default:
                    break;
            }
        });

        return createBiVehicleCardPayRecordHourFeignDTO;
    }
    //************KeTop************
    //************Card Pay Statistics************

}
